package cn.highedu.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

// @Configuration
public class ActuatorSecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
//        http.authorizeRequests()
//                .mvcMatchers("/actuator/health", "/actuator/info").permitAll()
//                .mvcMatchers("/actuator/**").hasRole("ACTUATOR")
//                .anyRequest().authenticated();
//        http.formLogin().permitAll();
//        http.authorizeRequests()
//                .mvcMatchers("/actuator/**").permitAll()
//                .and().formLogin().permitAll();
    }

    @Override
    public void configure(WebSecurity web) throws Exception {
        web.debug(true).ignoring().mvcMatchers("/actuator/**");
    }
}
